<template>
	<gracePage :headerHeight="0" :isSwitchPage="true">
		<view slot="gBody" class="grace-body">
			<view class="grace-list">
				<view class="grace-list-items">
					<view class="grace-list-image ucenter-face grace-relative">
						<image class="grace-list-image ucenter-face-image" :src="userInfo.avatar" mode="widthFix"></image>
					</view>
					<view class="grace-list-body">
						<view class="grace-list-title">
							<text class="grace-list-title-text">{{userInfo.nickname}}</text>
						</view>
						<view class="grace-list-body-desc">ID:{{userInfo.username}}</view>
					</view>
					<button class="grace-button" plain="true" type="warn" @tap="goEditUserInfo">编辑</button>
				</view>
			</view>
			<view class="ucenter-line"></view>
			<view class="grace-list grace-margin-top">
				<view class="grace-list-items" @tap="goAddress">
					<view class="grace-list-body">
						<view class="grace-list-title">
							<text class="grace-list-title-text">收货地址</text>
						</view>
					</view>
					<text class="grace-list-arrow-right grace-icons icon-arrow-right"></text>
				</view>
			</view>
			<view class="ucenter-line"></view>
			<view class="grace-list grace-margin-top">
				<view class="grace-list-items" @tap="goPrivate">
					<view class="grace-list-body grace-border-b">
						<view class="grace-list-title">
							<text class="grace-list-title-text">隐私</text>
						</view>
					</view>
					<text class="grace-list-arrow-right grace-icons icon-arrow-right"></text>
				</view>
				<view class="grace-list-items" @tap="goClearCache">
					<view class="grace-list-body">
						<view class="grace-list-title">
							<text class="grace-list-title-text">清除缓存</text>
						</view>
					</view>
					<text class="grace-list-arrow-right grace-icons icon-arrow-right"></text>
				</view>
			</view>
			<view class="ucenter-line"></view>
			<view class="grace-list grace-margin-top">
				<view class="grace-list-items" @tap="goAboutapp">
					<view class="grace-list-body">
						<view class="grace-list-title">
							<text class="grace-list-title-text">关于党建APP</text>
						</view>
					</view>
					<text class="grace-list-arrow-right grace-icons icon-arrow-right"></text>
				</view>
			</view>
			<button class="grace-button" type='warn' style="width:98%;" @tap="logout">退出登录</button>
		</view>
	</gracePage>
</template>
<script>
import {
	mapState
} from 'vuex';
import gracePage from "../../graceUI/components/gracePage.vue";
import graceBoxBanner from "../../graceUI/components/graceBoxBanner.vue";
export default {
	data() {
		return {
		}
	},
	computed: {
		...mapState(['userInfo'])
	},
	methods:{
		//编辑资料
		goEditUserInfo: function() {
			this.$mRouter.push({
				route: this.$mRoutesConfig.editUserInfo
			})
		},
		//收货地址
		goAddress: function() {
			this.$mRouter.push({
				route: this.$mRoutesConfig.addressList
			})
		},
		//隐私
		goPrivate: function() {
			this.$mRouter.push({
				route: this.$mRoutesConfig.setup
			})
		},
		//清除缓存
		goClearCache: function() {
			this.$mRouter.push({
				route: this.$mRoutesConfig.setup
			})
		},
		//关于APP
		goAboutapp: function() {
			this.$mRouter.push({
				route: this.$mRoutesConfig.setup
			})
		},
		//退出登录
		logout: function() {
			this.$store.commit("SET_TOKEN","");
			uni.switchTab({
				url:'../index/index'
			})
		},
	},
	components:{
		gracePage, graceBoxBanner
	}
}
</script>
<style>
.ucenter-face{width:100rpx !important; height:100rpx !important;}
.ucenter-face-image{width:100rpx !important; height:100rpx !important;}
.ucenter-line{height:12rpx; background-color:#F4F5F6; margin:16rpx 0;}
</style>